package com.potevio.simulator.strategy.impl;


import com.potevio.simulator.common.CommonFlag;
import com.potevio.simulator.config.MsgTypeConst;
import com.potevio.simulator.strategy.ReceiveMsgStrategy;
import io.netty.channel.ChannelHandlerContext;

import java.util.LinkedHashMap;
import java.util.Map;


/**
 * @ClassName Receive68
 * @Description: 接收68报文
 * @Date 2021/6/1  10:27
 * @Author zyd
 */
public class Receive68Command implements ReceiveMsgStrategy {

    @Override
    public void receiveMessage(ChannelHandlerContext ctx, Map<String, LinkedHashMap<String, String>> resultHexMap, String revertCommandCode) throws Exception {
        if(! ("3.4".equals(CommonFlag.version))){
            //枪号集合删除结束充电枪号
            for (int i = 0; i < MsgTypeConst.CHARGE_POSTS.size(); i++) {
                // 选择要停止的充电枪号
                if (MsgTypeConst.CHARGE_POSTS.get(i).equals(CommonFlag.chargeNum)) {
                    // 将该枪号从充电中得枪号集合删除
                    MsgTypeConst.CHARGE_POSTS.remove(i);
                    break;
                }
            }
        }

        System.out.println("收到68，充电结束。。。。。。。。。");
    }

}
